<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\AdminController;
use Illuminate\Http\Request;
use App\Models\Set as TSet;

class Set extends AdminController{
    
    protected $model = null;
    
    public function index(Request $request){
        $settings = TSet::getSet();
        return $this->V("index",array('settings'=>$settings));
    }
    
    public function post(Request $request){
        if ($request->method() == 'POST') {
            $settings = [
                    'base'=>$request->input('base'),
                    'wxpay'=>$request->input('wxpay'),
                    'alipay'=>$request->input('alipay'),
            ];
            foreach ($settings as $key => $value) {
                TSet::setSet($key,$value);
            }
            return wxresp(1, '保存成功');
        }
        return wxresp(0);
    }
}